# pip install bs4
# pip install requests
import requests
from bs4 import BeautifulSoup

r = requests.get(url='https://www.douyu.com/directory/all')
# print(r.content)

c = r.content
soup = BeautifulSoup(c, 'html.parser')
# print(soup.prettify())
listContent = soup.find('div', {'class': 'layout-Module-container layout-Cover ListContent'})
cover_list = listContent.find('ul', {'class': 'layout-Cover-list'})
# print(cover_list)
cover_items = cover_list.find_all('li', {'class': 'layout-Cover-item'})
    # print(cover_items[0])
for item in cover_items:
    title = item.find('h3', {'class': 'DyListCover-intro'}).text
    name = item.find('h2', {'class': 'DyListCover-user'}).text
    # fire = item.find('span', {'class': 'DyListCover-hot'})
    print(title, name)
